<?php

class Application_Model_UseFul extends Application_Model_ModelAbstract
{
    public $useful_id;
    public $useful_title;
    public $useful_desc;
    public $useful_date;
    public $useful_is_active;

    /**
     * @param mixed $useful_date
     */
    public function setUsefulDate($useful_date)
    {
        $this->useful_date = $useful_date;
    }

    /**
     * @return mixed
     */
    public function getUsefulDate()
    {
        $time = strtotime($this->useful_date);
        $labelTime = date('d.m.Y', $time);

        $arrM = array(
            '01'=>'янв', '02'=>'фев', '03'=>'мар', '04'=>'апр',
            '05'=>'май', '06'=>'июн', '07'=>'июл', '08'=>'авг',
            '09'=>'сен', '10'=>'окт', '11'=>'ноя', '12'=>'дек'
        );

        if ($labelTime == date('d.m.Y')) {
            return 'Сегодня в '.date('H:i', $time);
        } elseif ($labelTime == (date('d') - 1).'.'.date('m.Y')) {
            return 'Вчера в '.date('H:i', $time);
        } else {
            return date('d', $time).' '.$arrM[date('m', $time)].' '.date('Y', $time).' в '.date('H:i', $time);
        }
    }

    /**
     * @param mixed $useful_desc
     */
    public function setUsefulDesc($useful_desc)
    {
        $this->useful_desc = $useful_desc;
    }

    /**
     * @return mixed
     */
    public function getUsefulDesc()
    {
        return $this->useful_desc;
    }

    /**
     * @param mixed $useful_id
     */
    public function setUsefulId($useful_id)
    {
        $this->useful_id = $useful_id;
    }

    /**
     * @return mixed
     */
    public function getId()
    {
        return $this->useful_id;
    }

    /**
     * @param mixed $useful_is_active
     */
    public function setUsefulIsActive($useful_is_active)
    {
        $this->useful_is_active = $useful_is_active;
    }

    /**
     * @return mixed
     */
    public function getUsefulIsActive()
    {
        return $this->useful_is_active;
    }

    /**
     * @param mixed $useful_title
     */
    public function setUsefulTitle($useful_title)
    {
        $this->useful_title = $useful_title;
    }

    /**
     * @return mixed
     */
    public function getUsefulTitle()
    {
        return $this->useful_title;
    }
}